3.6.22 \(\int \cos ^4(c+d x) (a+b \tan (c+d x))^2 \, dx\) [522]

Optimal. Leaf size=88 \[ \frac {1}{8} \left (3 a^2+b^2\right ) x-\frac {\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}-\frac {\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d} \]

[Out]

1/8*(3*a^2+b^2)*x-1/4*cos(d*x+c)^4*(b-a*tan(d*x+c))*(a+b*tan(d*x+c))/d-1/8*cos(d*x+c)^2*(2*a*b-(3*a^2+b^2)*tan
(d*x+c))/d

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3587, 753, 653, 209} \begin {gather*} -\frac {\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}+\frac {1}{8} x \left (3 a^2+b^2\right )-\frac {\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

((3*a^2 + b^2)*x)/8 - (Cos[c + d*x]^4*(b - a*Tan[c + d*x])*(a + b*Tan[c + d*x]))/(4*d) - (Cos[c + d*x]^2*(2*a*
b - (3*a^2 + b^2)*Tan[c + d*x]))/(8*d)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 653

Int[((d_) + (e_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((a*e - c*d*x)/(2*a*c*(p + 1)))*(a + c*x
^2)^(p + 1), x] + Dist[d*((2*p + 3)/(2*a*(p + 1))), Int[(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x]
&& LtQ[p, -1] && NeQ[p, -3/2]

Rule 753

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(d + e*x)^(m - 1)*(a*e - c*d*x)*((a
 + c*x^2)^(p + 1)/(2*a*c*(p + 1))), x] + Dist[1/((p + 1)*(-2*a*c)), Int[(d + e*x)^(m - 2)*Simp[a*e^2*(m - 1) -
 c*d^2*(2*p + 3) - d*c*e*(m + 2*p + 2)*x, x]*(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x] && NeQ[c*d^
2 + a*e^2, 0] && LtQ[p, -1] && GtQ[m, 1] && IntQuadraticQ[a, 0, c, d, e, m, p, x]

Rule 3587

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(b*f), Subst
[Int[(a + x)^n*(1 + x^2/b^2)^(m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && NeQ[a^2 + b
^2, 0] && IntegerQ[m/2]

Rubi steps

\begin {align*} \int \cos ^4(c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac {\text {Subst}\left (\int \frac {(a+x)^2}{\left (1+\frac {x^2}{b^2}\right )^3} \, dx,x,b \tan (c+d x)\right )}{b d}\\ &=-\frac {\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}+\frac {b \text {Subst}\left (\int \frac {1+\frac {3 a^2}{b^2}+\frac {2 a x}{b^2}}{\left (1+\frac {x^2}{b^2}\right )^2} \, dx,x,b \tan (c+d x)\right )}{4 d}\\ &=-\frac {\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}-\frac {\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}+\frac {\left (\left (1+\frac {3 a^2}{b^2}\right ) b\right ) \text {Subst}\left (\int \frac {1}{1+\frac {x^2}{b^2}} \, dx,x,b \tan (c+d x)\right )}{8 d}\\ &=\frac {1}{8} \left (3 a^2+b^2\right ) x-\frac {\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}-\frac {\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(216\) vs. \(2(88)=176\).
time = 3.24, size = 216, normalized size = 2.45 \begin {gather*} \frac {\frac {\left (3 a^2+b^2\right ) \left (2 a b \sqrt {-b^2} \left (2 a^2+b^2\right )-2 a b \sqrt {-b^2} \left (a^2+b^2\right ) \cos (2 (c+d x))+b \left (a^2+b^2\right )^2 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-b \left (a^2+b^2\right )^2 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )-\sqrt {-b^2} \left (-a^4+b^4\right ) \sin (2 (c+d x))\right )}{\sqrt {-b^2}}+4 \left (a^2+b^2\right ) \cos ^4(c+d x) (b+a \tan (c+d x)) (a+b \tan (c+d x))^3}{16 \left (a^2+b^2\right )^2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

(((3*a^2 + b^2)*(2*a*b*Sqrt[-b^2]*(2*a^2 + b^2) - 2*a*b*Sqrt[-b^2]*(a^2 + b^2)*Cos[2*(c + d*x)] + b*(a^2 + b^2
)^2*Log[Sqrt[-b^2] - b*Tan[c + d*x]] - b*(a^2 + b^2)^2*Log[Sqrt[-b^2] + b*Tan[c + d*x]] - Sqrt[-b^2]*(-a^4 + b
^4)*Sin[2*(c + d*x)]))/Sqrt[-b^2] + 4*(a^2 + b^2)*Cos[c + d*x]^4*(b + a*Tan[c + d*x])*(a + b*Tan[c + d*x])^3)/
(16*(a^2 + b^2)^2*d)

________________________________________________________________________________________

Maple [A]
time = 0.22, size = 97, normalized size = 1.10

method result size
derivativedivides \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )-\frac {a b \left (\cos ^{4}\left (d x +c \right )\right )}{2}+a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) \(97\)
default \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )-\frac {a b \left (\cos ^{4}\left (d x +c \right )\right )}{2}+a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) \(97\)
risch \(\frac {3 a^{2} x}{8}+\frac {b^{2} x}{8}-\frac {a b \cos \left (4 d x +4 c \right )}{16 d}+\frac {a^{2} \sin \left (4 d x +4 c \right )}{32 d}-\frac {\sin \left (4 d x +4 c \right ) b^{2}}{32 d}-\frac {a b \cos \left (2 d x +2 c \right )}{4 d}+\frac {a^{2} \sin \left (2 d x +2 c \right )}{4 d}\) \(97\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(b^2*(-1/4*sin(d*x+c)*cos(d*x+c)^3+1/8*sin(d*x+c)*cos(d*x+c)+1/8*d*x+1/8*c)-1/2*a*b*cos(d*x+c)^4+a^2*(1/4*
(cos(d*x+c)^3+3/2*cos(d*x+c))*sin(d*x+c)+3/8*d*x+3/8*c))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 85, normalized size = 0.97 \begin {gather*} \frac {{\left (3 \, a^{2} + b^{2}\right )} {\left (d x + c\right )} + \frac {{\left (3 \, a^{2} + b^{2}\right )} \tan \left (d x + c\right )^{3} - 4 \, a b + {\left (5 \, a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{4} + 2 \, \tan \left (d x + c\right )^{2} + 1}}{8 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/8*((3*a^2 + b^2)*(d*x + c) + ((3*a^2 + b^2)*tan(d*x + c)^3 - 4*a*b + (5*a^2 - b^2)*tan(d*x + c))/(tan(d*x +
c)^4 + 2*tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]
time = 0.37, size = 75, normalized size = 0.85 \begin {gather*} -\frac {4 \, a b \cos \left (d x + c\right )^{4} - {\left (3 \, a^{2} + b^{2}\right )} d x - {\left (2 \, {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{3} + {\left (3 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{8 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/8*(4*a*b*cos(d*x + c)^4 - (3*a^2 + b^2)*d*x - (2*(a^2 - b^2)*cos(d*x + c)^3 + (3*a^2 + b^2)*cos(d*x + c))*s
in(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \cos ^{4}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**4*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*cos(c + d*x)**4, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2286 vs. \(2 (83) = 166\).
time = 2.67, size = 2286, normalized size = 25.98 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/64*(3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*
tan(c))*tan(d*x)^4*tan(c)^4 + 24*a^2*d*x*tan(d*x)^4*tan(c)^4 + 8*b^2*d*x*tan(d*x)^4*tan(c)^4 + 3*pi*b^2*sgn(-2
*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^4*tan(c)^4 + 6*pi*b^2*sgn(2*tan(d*x
)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^4*tan(c)^2
+ 6*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(
c))*tan(d*x)^2*tan(c)^4 + 6*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^4*tan(c)^4 - 6*b^2*
arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^4*tan(c)^4 + 48*a^2*d*x*tan(d*x)^4*tan(c)^2 + 16*b
^2*d*x*tan(d*x)^4*tan(c)^2 + 6*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*
tan(d*x)^4*tan(c)^2 + 48*a^2*d*x*tan(d*x)^2*tan(c)^4 + 16*b^2*d*x*tan(d*x)^2*tan(c)^4 + 6*pi*b^2*sgn(-2*tan(d*
x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^2*tan(c)^4 - 20*a*b*tan(d*x)^4*tan(c)^4 +
3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c)
)*tan(d*x)^4 + 12*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan
(d*x) - 2*tan(c))*tan(d*x)^2*tan(c)^2 + 12*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^4*ta
n(c)^2 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^4*tan(c)^2 - 40*a^2*tan(d*x)^4*tan
(c)^3 + 8*b^2*tan(d*x)^4*tan(c)^3 + 3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d
*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(c)^4 + 12*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(
d*x)^2*tan(c)^4 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^4 - 40*a^2*tan(d
*x)^3*tan(c)^4 + 8*b^2*tan(d*x)^3*tan(c)^4 + 24*a^2*d*x*tan(d*x)^4 + 8*b^2*d*x*tan(d*x)^4 + 3*pi*b^2*sgn(-2*ta
n(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^4 + 96*a^2*d*x*tan(d*x)^2*tan(c)^2 + 3
2*b^2*d*x*tan(d*x)^2*tan(c)^2 + 12*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(
c))*tan(d*x)^2*tan(c)^2 + 24*a*b*tan(d*x)^4*tan(c)^2 + 128*a*b*tan(d*x)^3*tan(c)^3 + 24*a^2*d*x*tan(c)^4 + 8*b
^2*d*x*tan(c)^4 + 3*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(c)^4 +
24*a*b*tan(d*x)^2*tan(c)^4 + 6*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan
(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^2 + 6*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^4
 - 6*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^4 - 24*a^2*tan(d*x)^4*tan(c) - 8*b^2*tan(
d*x)^4*tan(c) + 6*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan
(d*x) - 2*tan(c))*tan(c)^2 + 24*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^2*tan(c)^2 - 24
*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 + 48*a^2*tan(d*x)^3*tan(c)^2 - 48*
b^2*tan(d*x)^3*tan(c)^2 + 48*a^2*tan(d*x)^2*tan(c)^3 - 48*b^2*tan(d*x)^2*tan(c)^3 + 6*b^2*arctan((tan(d*x) + t
an(c))/(tan(d*x)*tan(c) - 1))*tan(c)^4 - 6*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(c)^4 - 2
4*a^2*tan(d*x)*tan(c)^4 - 8*b^2*tan(d*x)*tan(c)^4 + 48*a^2*d*x*tan(d*x)^2 + 16*b^2*d*x*tan(d*x)^2 + 6*pi*b^2*s
gn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^2 + 12*a*b*tan(d*x)^4 + 48*a^2
*d*x*tan(c)^2 + 16*b^2*d*x*tan(c)^2 + 6*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2
*tan(c))*tan(c)^2 - 144*a*b*tan(d*x)^2*tan(c)^2 + 12*a*b*tan(c)^4 + 3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sg
n(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c)) + 12*b^2*arctan((tan(d*x) + tan(c))/(tan
(d*x)*tan(c) - 1))*tan(d*x)^2 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^2 + 24*a^2*
tan(d*x)^3 + 8*b^2*tan(d*x)^3 - 48*a^2*tan(d*x)^2*tan(c) + 48*b^2*tan(d*x)^2*tan(c) + 12*b^2*arctan((tan(d*x)
+ tan(c))/(tan(d*x)*tan(c) - 1))*tan(c)^2 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(c)^2
 - 48*a^2*tan(d*x)*tan(c)^2 + 48*b^2*tan(d*x)*tan(c)^2 + 24*a^2*tan(c)^3 + 8*b^2*tan(c)^3 + 24*a^2*d*x + 8*b^2
*d*x + 3*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c)) + 24*a*b*tan(d*x)^2 +
128*a*b*tan(d*x)*tan(c) + 24*a*b*tan(c)^2 + 6*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1)) - 6*b^2*ar
ctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1)) + 40*a^2*tan(d*x) - 8*b^2*tan(d*x) + 40*a^2*tan(c) - 8*b^2*ta
n(c) - 20*a*b)/(d*tan(d*x)^4*tan(c)^4 + 2*d*tan(d*x)^4*tan(c)^2 + 2*d*tan(d*x)^2*tan(c)^4 + d*tan(d*x)^4 + 4*d
*tan(d*x)^2*tan(c)^2 + d*tan(c)^4 + 2*d*tan(d*x)^2 + 2*d*tan(c)^2 + d)

________________________________________________________________________________________

Mupad [B]
time = 3.66, size = 83, normalized size = 0.94 \begin {gather*} x\,\left (\frac {3\,a^2}{8}+\frac {b^2}{8}\right )+\frac {\left (\frac {3\,a^2}{8}+\frac {b^2}{8}\right )\,{\mathrm {tan}\left (c+d\,x\right )}^3+\left (\frac {5\,a^2}{8}-\frac {b^2}{8}\right )\,\mathrm {tan}\left (c+d\,x\right )-\frac {a\,b}{2}}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^4+2\,{\mathrm {tan}\left (c+d\,x\right )}^2+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^4*(a + b*tan(c + d*x))^2,x)

[Out]

x*((3*a^2)/8 + b^2/8) + (tan(c + d*x)*((5*a^2)/8 - b^2/8) - (a*b)/2 + tan(c + d*x)^3*((3*a^2)/8 + b^2/8))/(d*(
2*tan(c + d*x)^2 + tan(c + d*x)^4 + 1))

________________________________________________________________________________________